<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * BeamrPresentation filter form base class.
 *
 * @package    filters
 * @subpackage BeamrPresentation *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseBeamrPresentationFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'title'           => new sfWidgetFormFilterInput(),
      'title_short'     => new sfWidgetFormFilterInput(),
      'author'          => new sfWidgetFormFilterInput(),
      'author_short'    => new sfWidgetFormFilterInput(),
      'date'            => new sfWidgetFormFilterInput(),
      'date_short'      => new sfWidgetFormFilterInput(),
      'institute'       => new sfWidgetFormFilterInput(),
      'institute_short' => new sfWidgetFormFilterInput(),
      'theme'           => new sfWidgetFormDoctrineChoice(array('model' => 'BeamrThemes', 'add_empty' => true)),
      'colortheme'      => new sfWidgetFormDoctrineChoice(array('model' => 'BeamrColorThemes', 'add_empty' => true)),
      'is_public'       => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'token'           => new sfWidgetFormFilterInput(),
      'user_id'         => new sfWidgetFormDoctrineChoice(array('model' => 'sfGuardUser', 'add_empty' => true)),
      'created_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
    ));

    $this->setValidators(array(
      'title'           => new sfValidatorPass(array('required' => false)),
      'title_short'     => new sfValidatorPass(array('required' => false)),
      'author'          => new sfValidatorPass(array('required' => false)),
      'author_short'    => new sfValidatorPass(array('required' => false)),
      'date'            => new sfValidatorPass(array('required' => false)),
      'date_short'      => new sfValidatorPass(array('required' => false)),
      'institute'       => new sfValidatorPass(array('required' => false)),
      'institute_short' => new sfValidatorPass(array('required' => false)),
      'theme'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'BeamrThemes', 'column' => 'id')),
      'colortheme'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'BeamrColorThemes', 'column' => 'id')),
      'is_public'       => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'token'           => new sfValidatorPass(array('required' => false)),
      'user_id'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'sfGuardUser', 'column' => 'id')),
      'created_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('beamr_presentation_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'BeamrPresentation';
  }

  public function getFields()
  {
    return array(
      'id'              => 'Number',
      'title'           => 'Text',
      'title_short'     => 'Text',
      'author'          => 'Text',
      'author_short'    => 'Text',
      'date'            => 'Text',
      'date_short'      => 'Text',
      'institute'       => 'Text',
      'institute_short' => 'Text',
      'theme'           => 'ForeignKey',
      'colortheme'      => 'ForeignKey',
      'is_public'       => 'Boolean',
      'token'           => 'Text',
      'user_id'         => 'ForeignKey',
      'created_at'      => 'Date',
      'updated_at'      => 'Date',
    );
  }
}